import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { caraccessrecordsVO, caraccessrecordsForm, caraccessrecordsQuery } from '@/api/transitoverview/carAccessRecords/types';

/**
 * 查询车辆通行记录列表
 * @param query
 * @returns {*}
 */

export const listcaraccessrecords = (query?: caraccessrecordsQuery): AxiosPromise<caraccessrecordsVO[]> => {
  return request({
    url: '/transitoverview/carAccessRecords/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询车辆通行记录详细
 * @param carAccessRecordsId
 */
export const getcaraccessrecords = (carAccessRecordsId: string | number): AxiosPromise<caraccessrecordsVO> => {
  return request({
    url: '/transitoverview/carAccessRecords/' + carAccessRecordsId,
    method: 'get'
  });
};

/**
 * 新增车辆通行记录
 * @param data
 */
export const addcaraccessrecords = (data: caraccessrecordsForm) => {
  return request({
    url: '/transitoverview/carAccessRecords',
    method: 'post',
    data: data
  });
};

/**
 * 修改车辆通行记录
 * @param data
 */
export const updatecaraccessrecords = (data: caraccessrecordsForm) => {
  return request({
    url: '/transitoverview/carAccessRecords',
    method: 'put',
    data: data
  });
};

/**
 * 删除车辆通行记录
 * @param carAccessRecordsId
 */
export const delcaraccessrecords = (carAccessRecordsId: string | number | Array<string | number>) => {
  return request({
    url: '/transitoverview/carAccessRecords/' + carAccessRecordsId,
    method: 'delete'
  });
};
